<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
  <div id="app1"></div>
  <div id="app2"></div>
  <script src="js/vue.js"></script>
  <script>
    // 定义一个mixin对象
    const myMixin = {
      data() {
        return {
          msg: '撩课学院'
        }
      },
      methods:{
        hello(){
          alert('hello, 撩课学院');
        }
      },
    };

    const app1 = Vue.createApp({
      mixins: [myMixin],
      template: `
        <div>
           <h1>{{msg}}</h1>
           <button @click="hello">打个招呼</button>
        </div>
      `
    });
    app1.mount('#app1');


    const app2 = Vue.createApp({
      mixins: [myMixin],
      template: `
        <div>
           <h1>{{msg}}</h1>
           <button @click="hello">打个招呼</button>
        </div>
      `
    });
    app2.mount('#app2');
  </script>
</body>
</html>
